package com.summer.data.table.column;

import com.summer.data.table.BaseColumn;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author 345480567@qq.com
 */

public class DecimalColumn extends BaseColumn<BigDecimal> {

    public int P;

    public int D;

    public DecimalColumn(String colName) {
        super(colName);
        this.P = 10;
        this.D = 0;
    }

    public DecimalColumn(String colName, int P, int D) {
        super(colName);
        this.P = P;
        this.D = D;
    }

    @Override
    public void fetchNotNullValue(ResultSet resultSet, Integer index) throws SQLException {
        value = getValue(resultSet, index);
    }

    public static BigDecimal getValue(ResultSet resultSet, Integer index) throws SQLException {
        BigDecimal value = resultSet.getBigDecimal(index);
        return value;
    }

}
